<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/lib/layui/css/layui.css" media="all">


</head>
<body>

<form class="layui-form" action="">
    <input type="hidden" name="id" th:value="${item.siid}">
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <input type="text" name="money" th:value="${item.simoney}" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
            <input type="text" name="number" th:value="${item.sinumber}" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
            <input type="text" name="state" th:value="${item.sistate}" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="/lib/layui/layui.js"></script>
<script>
    //Demo
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $ = layui.jquery;
        //监听提交
        form.on('submit(formDemo)', function(data){
           // layer.msg(JSON.stringify(data.field));
            //JSON.stringify(data.field) Json是js里面的json格式化工具
            $.post("/supply/save",data.field,function (resp) {
                if(resp.code==0){
                    //true

                    var index = parent.layer.getFrameIndex(window.name);//获取当前弹窗的Id
                    parent.layer.close(index);//关闭

                }else {
                    layer.msg(resp.msg)
                }
            })

            return false;
        });
    });
</script>
</body>
</html>
